package cn.zl.springbootredis.service.UserServiceImpl;

import cn.zl.springbootredis.entity.User;
import cn.zl.springbootredis.dao.UserDao;
import cn.zl.springbootredis.service.UserService.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description:
 * @Author: zhanglang
 * @Date: 2020/9/7 14:54
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
//    @Transactional(propagation = Propagation.SUPPORTS)
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
//    @Transactional(propagation = Propagation.SUPPORTS)
    public User findById(Long id) {
        return userDao.findById(id);
    }

    @Override
//    @Transactional(propagation = Propagation.SUPPORTS)
    public void delete(Long id) {
        userDao.delete(id);
    }

    @Override
    public void save(User user) {
        userDao.save(user);
    }

    @Override
    public void update(User user) {
        userDao.update(user);
    }
}
